create table TDUCK.AC_USER
(
    ID                 NUMBER(19)                              not null
        primary key
        check (id > 0),
    NAME               VARCHAR2(32 char)  default ''           not null,
    AVATAR             VARCHAR2(256 char) default ''           not null,
    GENDER             NUMBER(3)          default 0            not null,
    EMAIL              VARCHAR2(100 char),
    PHONE_NUMBER       VARCHAR2(11 char),
    PASSWORD           VARCHAR2(255 char),
    REG_CHANNEL        VARCHAR2(255 char),
    LAST_LOGIN_CHANNEL NUMBER(3),
    LAST_LOGIN_TIME    TIMESTAMP(0),
    LAST_LOGIN_IP      VARCHAR2(50 char),
    PASSWORD_TYPE      NUMBER(3)          default 0,
    DELETED            NUMBER(3)          default 0,
    CREATE_TIME        TIMESTAMP(0)       default SYSTIMESTAMP not null,
    UPDATE_TIME        TIMESTAMP(0)       default SYSTIMESTAMP not null
)
    /

comment on table TDUCK.AC_USER is '用户'
/

comment on column TDUCK.AC_USER.NAME is '姓名'
/

comment on column TDUCK.AC_USER.AVATAR is '头像'
/

comment on column TDUCK.AC_USER.GENDER is '性别0未知 1男2女'
/

comment on column TDUCK.AC_USER.EMAIL is '邮箱'
/

comment on column TDUCK.AC_USER.PHONE_NUMBER is '手机号'
/

comment on column TDUCK.AC_USER.PASSWORD is '密码'
/

comment on column TDUCK.AC_USER.REG_CHANNEL is '注册渠道'
/

comment on column TDUCK.AC_USER.LAST_LOGIN_CHANNEL is '最后登录渠道'
/

comment on column TDUCK.AC_USER.LAST_LOGIN_TIME is '最后登录时间'
/

comment on column TDUCK.AC_USER.LAST_LOGIN_IP is '最后登录Ip'
/

comment on column TDUCK.AC_USER.PASSWORD_TYPE is '密码类型'
/

comment on column TDUCK.AC_USER.DELETED is '状态'
/

create trigger TDUCK.AC_USER_SEQ_TR
    before insert
    on TDUCK.AC_USER
    for each row
    when (new.id is null)
begin
    select tduck.ac_user_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.AC_USER_AUTHORIZE
(
    ID          NUMBER(19)                        not null
        primary key
        check (id > 0),
    TYPE        NUMBER(3)                         not null,
    APP_ID      VARCHAR2(150 char),
    OPEN_ID     VARCHAR2(150 char)                not null,
    USER_NAME   VARCHAR2(255 char)                not null,
    USER_ID     NUMBER(19),
    USER_INFO   VARCHAR2(4000),
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP not null,
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP not null,
    constraint OPEN_ID
        unique (OPEN_ID, TYPE)
)
    /

comment on table TDUCK.AC_USER_AUTHORIZE is '第三方用户授权信息'
/

comment on column TDUCK.AC_USER_AUTHORIZE.TYPE is '第三方平台类型'
/

comment on column TDUCK.AC_USER_AUTHORIZE.APP_ID is '平台AppId'
/

comment on column TDUCK.AC_USER_AUTHORIZE.OPEN_ID is '平台OpenId'
/

comment on column TDUCK.AC_USER_AUTHORIZE.USER_NAME is '平台用户名'
/

comment on column TDUCK.AC_USER_AUTHORIZE.USER_ID is '用户Id'
/

comment on column TDUCK.AC_USER_AUTHORIZE.USER_INFO is '平台用户信息'
/

create trigger TDUCK.AC_USER_AUTHORIZE_SEQ_TR
    before insert
    on TDUCK.AC_USER_AUTHORIZE
    for each row
    when (new.id is null)
begin
    select tduck.ac_user_authorize_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.AC_USER_TOKEN
(
    ID          NUMBER(19)                        not null
        primary key
        check (id > 0),
    TYPE        NUMBER(10)   default 0            not null,
    USER_ID     NUMBER(19)                        not null,
    TOKEN       VARCHAR2(255 char)                not null
        constraint TOKEN
        unique,
    EXPIRE_TIME TIMESTAMP(0) default SYSTIMESTAMP not null,
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP not null,
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP not null
)
    /

comment on table TDUCK.AC_USER_TOKEN is '用户'
/

comment on column TDUCK.AC_USER_TOKEN.TYPE is '类型'
/

comment on column TDUCK.AC_USER_TOKEN.USER_ID is '用户Id'
/

comment on column TDUCK.AC_USER_TOKEN.TOKEN is 'token'
/

comment on column TDUCK.AC_USER_TOKEN.EXPIRE_TIME is '过期时间'
/

create trigger TDUCK.AC_USER_TOKEN_SEQ_TR
    before insert
    on TDUCK.AC_USER_TOKEN
    for each row
    when (new.id is null)
begin
    select tduck.ac_user_token_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_FORM_TEMPLATE
(
    ID          NUMBER(19)             not null
        primary key,
    FORM_KEY    VARCHAR2(50 char)      not null,
    COVER_IMG   VARCHAR2(100 char),
    NAME        CLOB                   not null,
    DESCRIPTION CLOB,
    CATEGORY_ID NUMBER(10)             not null,
    SCHEME      VARCHAR2(4000),
    STATUS      NUMBER(3)    default 0 not null,
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_FORM_TEMPLATE is '表单模板'
/

comment on column TDUCK.FM_FORM_TEMPLATE.ID is '模板Id'
/

comment on column TDUCK.FM_FORM_TEMPLATE.FORM_KEY is '模板唯一标识'
/

comment on column TDUCK.FM_FORM_TEMPLATE.COVER_IMG is '封面图'
/

comment on column TDUCK.FM_FORM_TEMPLATE.NAME is '模板名称'
/

comment on column TDUCK.FM_FORM_TEMPLATE.DESCRIPTION is '模板I描述'
/

comment on column TDUCK.FM_FORM_TEMPLATE.CATEGORY_ID is '模板类型'
/

comment on column TDUCK.FM_FORM_TEMPLATE.SCHEME is '模板定义'
/

comment on column TDUCK.FM_FORM_TEMPLATE.STATUS is '状态'
/

comment on column TDUCK.FM_FORM_TEMPLATE.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_FORM_TEMPLATE.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_FORM_TEMPLATE_SEQ_TR
    before insert
    on TDUCK.FM_FORM_TEMPLATE
    for each row
    when (new.id is null)
begin
    select tduck.fm_form_template_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_FORM_TEMPLATE_CATEGORY
(
    ID          NUMBER(19)        not null
        primary key,
    NAME        VARCHAR2(50 char) not null,
    SORT        NUMBER(10),
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_FORM_TEMPLATE_CATEGORY is '项目模板分类'
/

comment on column TDUCK.FM_FORM_TEMPLATE_CATEGORY.NAME is '分类名称'
/

comment on column TDUCK.FM_FORM_TEMPLATE_CATEGORY.SORT is '排序'
/

comment on column TDUCK.FM_FORM_TEMPLATE_CATEGORY.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_FORM_TEMPLATE_CATEGORY.CREATE_TIME is '创建时间'
/

create trigger TDUCK.TEMPLATE_CATEGORY_SEQ_TR
    before insert
    on TDUCK.FM_FORM_TEMPLATE_CATEGORY
    for each row
    when (new.id is null)
begin
    select tduck.fm_form_template_category_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_FORM_THEME
(
    ID             NUMBER(19)         not null
        primary key,
    NAME           VARCHAR2(50 char)  not null,
    STYLE          NUMBER(19)         not null,
    HEAD_IMG_URL   VARCHAR2(255 char) not null,
    BACKGROUND_IMG VARCHAR2(255 char),
    THEME_COLOR    VARCHAR2(20 char),
    UPDATE_TIME    TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME    TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_FORM_THEME is '项目主题外观模板'
/

comment on column TDUCK.FM_FORM_THEME.NAME is '主题名称'
/

comment on column TDUCK.FM_FORM_THEME.STYLE is '主题风格'
/

comment on column TDUCK.FM_FORM_THEME.HEAD_IMG_URL is '头部图片'
/

comment on column TDUCK.FM_FORM_THEME.BACKGROUND_IMG is '背景图片'
/

comment on column TDUCK.FM_FORM_THEME.THEME_COLOR is '主题颜色代码'
/

comment on column TDUCK.FM_FORM_THEME.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_FORM_THEME.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_FORM_THEME_SEQ_TR
    before insert
    on TDUCK.FM_FORM_THEME
    for each row
    when (new.id is null)
begin
    select tduck.fm_form_theme_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM
(
    ID          NUMBER(19)             not null
        primary key,
    FORM_KEY    VARCHAR2(50 char)      not null
        constraint CODE
        unique,
    SOURCE_ID   VARCHAR2(255 char),
    SOURCE_TYPE NUMBER(3),
    NAME        CLOB                   not null,
    DESCRIPTION CLOB,
    USER_ID     NUMBER(19)             not null,
    TYPE        VARCHAR2(10 char),
    STATUS      NUMBER(3)    default 0 not null,
    IS_DELETED  NUMBER(3)    default 0 not null,
    IS_FOLDER   NUMBER(3)    default 0,
    FOLDER_ID   NUMBER(19)   default 0,
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_USER_FORM is '用户表单'
/

comment on column TDUCK.FM_USER_FORM.FORM_KEY is '表单唯一标识'
/

comment on column TDUCK.FM_USER_FORM.SOURCE_ID is '来源Id'
/

comment on column TDUCK.FM_USER_FORM.SOURCE_TYPE is '来源类型'
/

comment on column TDUCK.FM_USER_FORM.NAME is '表单名称'
/

comment on column TDUCK.FM_USER_FORM.DESCRIPTION is '表单描述'
/

comment on column TDUCK.FM_USER_FORM.USER_ID is '用户ID'
/

comment on column TDUCK.FM_USER_FORM.TYPE is '表单类型'
/

comment on column TDUCK.FM_USER_FORM.STATUS is '状态'
/

comment on column TDUCK.FM_USER_FORM.IS_DELETED is '是否删除'
/

comment on column TDUCK.FM_USER_FORM.IS_FOLDER is '是文件夹'
/

comment on column TDUCK.FM_USER_FORM.FOLDER_ID is '文件夹Id'
/

comment on column TDUCK.FM_USER_FORM.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_USER_FORM.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_USER_FORM_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM_AUTH
(
    ID            NUMBER(19)        not null
        primary key,
    FORM_KEY      VARCHAR2(50 char) not null,
    AUTH_GROUP_ID NUMBER(19),
    USER_ID_LIST  VARCHAR2(4000),
    ROLE_ID_LIST  VARCHAR2(4000),
    DEPT_ID_LIST  VARCHAR2(4000),
    UPDATE_TIME   TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME   TIMESTAMP(0) default SYSTIMESTAMP,
    constraint PROJECT_KEY
        unique (FORM_KEY, AUTH_GROUP_ID)
)
    /

comment on table TDUCK.FM_USER_FORM_AUTH is '表单授权对象'
/

comment on column TDUCK.FM_USER_FORM_AUTH.FORM_KEY is '项目key'
/

comment on column TDUCK.FM_USER_FORM_AUTH.AUTH_GROUP_ID is '授权组id'
/

comment on column TDUCK.FM_USER_FORM_AUTH.USER_ID_LIST is '用户Id列表'
/

comment on column TDUCK.FM_USER_FORM_AUTH.ROLE_ID_LIST is '角色Id列表'
/

comment on column TDUCK.FM_USER_FORM_AUTH.DEPT_ID_LIST is '部门Id列表'
/

comment on column TDUCK.FM_USER_FORM_AUTH.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_USER_FORM_AUTH.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_USER_FORM_AUTH_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM_AUTH
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_auth_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM_DATA
(
    ID                NUMBER(19)         not null
        primary key,
    FORM_KEY          VARCHAR2(100 char) not null,
    SERIAL_NUMBER     NUMBER(10),
    ORIGINAL_DATA     VARCHAR2(4000),
    SUBMIT_UA         VARCHAR2(4000),
    SUBMIT_OS         VARCHAR2(50 char),
    SUBMIT_BROWSER    VARCHAR2(50 char),
    SUBMIT_REQUEST_IP VARCHAR2(50 char),
    SUBMIT_ADDRESS    VARCHAR2(50 char),
    COMPLETE_TIME     NUMBER(10),
    WX_OPEN_ID        VARCHAR2(100 char),
    WX_USER_INFO      VARCHAR2(4000),
    EXT_VALUE         VARCHAR2(255 char),
    CREATE_TIME       TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_BY         VARCHAR2(255 char),
    UPDATE_TIME       TIMESTAMP(0) default SYSTIMESTAMP,
    UPDATE_BY         VARCHAR2(255 char)
)
    /

comment on table TDUCK.FM_USER_FORM_DATA is '表单收集数据结果'
/

comment on column TDUCK.FM_USER_FORM_DATA.FORM_KEY is '表单key'
/

comment on column TDUCK.FM_USER_FORM_DATA.SERIAL_NUMBER is '序号'
/

comment on column TDUCK.FM_USER_FORM_DATA.ORIGINAL_DATA is '填写结果'
/

comment on column TDUCK.FM_USER_FORM_DATA.SUBMIT_UA is '提交ua'
/

comment on column TDUCK.FM_USER_FORM_DATA.SUBMIT_OS is '提交系统'
/

comment on column TDUCK.FM_USER_FORM_DATA.SUBMIT_BROWSER is '提交浏览器'
/

comment on column TDUCK.FM_USER_FORM_DATA.SUBMIT_REQUEST_IP is '请求ip'
/

comment on column TDUCK.FM_USER_FORM_DATA.SUBMIT_ADDRESS is '提交地址'
/

comment on column TDUCK.FM_USER_FORM_DATA.COMPLETE_TIME is '完成时间 毫秒'
/

comment on column TDUCK.FM_USER_FORM_DATA.WX_OPEN_ID is '微信openId'
/

comment on column TDUCK.FM_USER_FORM_DATA.WX_USER_INFO is '微信用户信息'
/

comment on column TDUCK.FM_USER_FORM_DATA.EXT_VALUE is '扩展字段记录来源等'
/

comment on column TDUCK.FM_USER_FORM_DATA.CREATE_TIME is '创建时间'
/

comment on column TDUCK.FM_USER_FORM_DATA.CREATE_BY is '创建人'
/

comment on column TDUCK.FM_USER_FORM_DATA.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_USER_FORM_DATA.UPDATE_BY is '更新人'
/

create trigger TDUCK.FM_USER_FORM_DATA_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM_DATA
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_data_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM_ITEM
(
    ID              NUMBER(19)              not null
        primary key,
    FORM_KEY        VARCHAR2(100 char)      not null,
    FORM_ITEM_ID    VARCHAR2(50 char)       not null,
    TYPE            VARCHAR2(25 char)       not null,
    LABEL           CLOB                    not null,
    IS_DISPLAY_TYPE NUMBER(3)    default 0  not null,
    IS_HIDE_TYPE    NUMBER(3)    default 0  not null,
    IS_SPECIAL_TYPE NUMBER(3)    default 0  not null,
    SHOW_LABEL      NUMBER(3)    default 0  not null,
    DEFAULT_VALUE   VARCHAR2(1000 char),
    REQUIRED        NUMBER(3)               not null,
    PLACEHOLDER     VARCHAR2(255 char),
    SORT            NUMBER(19)   default 0,
    SPAN            NUMBER(10)   default 24 not null,
    SCHEME          VARCHAR2(4000),
    REG_LIST        VARCHAR2(4000),
    UPDATE_TIME     TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME     TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_USER_FORM_ITEM is '表单项'
/

comment on column TDUCK.FM_USER_FORM_ITEM.FORM_KEY is '项目key'
/

comment on column TDUCK.FM_USER_FORM_ITEM.FORM_ITEM_ID is '表单项Id'
/

comment on column TDUCK.FM_USER_FORM_ITEM.TYPE is '表单项类型 '
/

comment on column TDUCK.FM_USER_FORM_ITEM.LABEL is '表单项标题'
/

comment on column TDUCK.FM_USER_FORM_ITEM.IS_DISPLAY_TYPE is '展示类型组件'
/

comment on column TDUCK.FM_USER_FORM_ITEM.IS_HIDE_TYPE is '隐藏类型组件'
/

comment on column TDUCK.FM_USER_FORM_ITEM.IS_SPECIAL_TYPE is '特殊处理类型'
/

comment on column TDUCK.FM_USER_FORM_ITEM.SHOW_LABEL is '是否显示标签'
/

comment on column TDUCK.FM_USER_FORM_ITEM.DEFAULT_VALUE is '表单项默认值'
/

comment on column TDUCK.FM_USER_FORM_ITEM.REQUIRED is '是否必填'
/

comment on column TDUCK.FM_USER_FORM_ITEM.PLACEHOLDER is '输入型提示文字'
/

comment on column TDUCK.FM_USER_FORM_ITEM.SORT is '排序'
/

comment on column TDUCK.FM_USER_FORM_ITEM.SPAN is '栅格宽度'
/

comment on column TDUCK.FM_USER_FORM_ITEM.SCHEME is '表表单原始JSON'
/

comment on column TDUCK.FM_USER_FORM_ITEM.REG_LIST is '正则表达式 '
/

comment on column TDUCK.FM_USER_FORM_ITEM.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_USER_FORM_ITEM.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_USER_FORM_ITEM_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM_ITEM
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_item_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM_LOGIC
(
    ID          NUMBER(19)         not null
        primary key,
    FORM_KEY    VARCHAR2(100 char) not null
        constraint FORM_LOGIC_KEY
        unique,
    SCHEME      VARCHAR2(4000),
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP,
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_USER_FORM_LOGIC is '项目逻辑'
/

comment on column TDUCK.FM_USER_FORM_LOGIC.ID is '逻辑Id'
/

comment on column TDUCK.FM_USER_FORM_LOGIC.FORM_KEY is '表单key'
/

comment on column TDUCK.FM_USER_FORM_LOGIC.SCHEME is '逻辑定义'
/

comment on column TDUCK.FM_USER_FORM_LOGIC.CREATE_TIME is '创建时间'
/

comment on column TDUCK.FM_USER_FORM_LOGIC.UPDATE_TIME is '更新时间'
/

create trigger TDUCK.FM_USER_FORM_LOGIC_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM_LOGIC
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_logic_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM_SETTING
(
    ID          NUMBER(19)         not null
        primary key,
    FORM_KEY    VARCHAR2(100 char) not null
        constraint FM_USER_FORM_SETTING_KEY
        unique,
    SETTINGS    VARCHAR2(4000),
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_USER_FORM_SETTING is '表单设置表'
/

comment on column TDUCK.FM_USER_FORM_SETTING.FORM_KEY is '表单key'
/

comment on column TDUCK.FM_USER_FORM_SETTING.SETTINGS is '设置内容 '
/

comment on column TDUCK.FM_USER_FORM_SETTING.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_USER_FORM_SETTING.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_USER_FORM_SETTING_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM_SETTING
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_setting_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM_THEME
(
    ID               NUMBER(19)         not null
        primary key,
    FORM_KEY         VARCHAR2(100 char) not null
        constraint FM_USER_FORM_THEME_KEY
        unique,
    SUBMIT_BTN_TEXT  VARCHAR2(20 char),
    LOGO_IMG         VARCHAR2(255 char),
    LOGO_POSITION    VARCHAR2(10 char),
    BACKGROUND_COLOR VARCHAR2(200 char),
    BACKGROUND_IMG   VARCHAR2(200 char),
    SHOW_TITLE       NUMBER(3)    default 1,
    SHOW_DESCRIBE    NUMBER(3)    default 1,
    THEME_COLOR      VARCHAR2(50 char),
    SHOW_NUMBER      NUMBER(3)    default 0,
    SHOW_SUBMIT_BTN  NUMBER(3)    default 1,
    HEAD_IMG_URL     VARCHAR2(255 char),
    UPDATE_TIME      TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME      TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_USER_FORM_THEME is '项目表单项'
/

comment on column TDUCK.FM_USER_FORM_THEME.FORM_KEY is '表单key'
/

comment on column TDUCK.FM_USER_FORM_THEME.SUBMIT_BTN_TEXT is '提交按钮文字'
/

comment on column TDUCK.FM_USER_FORM_THEME.LOGO_IMG is 'logo图片'
/

comment on column TDUCK.FM_USER_FORM_THEME.LOGO_POSITION is 'logo位置'
/

comment on column TDUCK.FM_USER_FORM_THEME.BACKGROUND_COLOR is '背景颜色'
/

comment on column TDUCK.FM_USER_FORM_THEME.BACKGROUND_IMG is '背景图片'
/

comment on column TDUCK.FM_USER_FORM_THEME.SHOW_TITLE is '是否显示标题'
/

comment on column TDUCK.FM_USER_FORM_THEME.SHOW_DESCRIBE is '是否显示描述语'
/

comment on column TDUCK.FM_USER_FORM_THEME.THEME_COLOR is '主题颜色
'
/

comment on column TDUCK.FM_USER_FORM_THEME.SHOW_NUMBER is '显示序号'
/

comment on column TDUCK.FM_USER_FORM_THEME.SHOW_SUBMIT_BTN is '显示提交按钮'
/

comment on column TDUCK.FM_USER_FORM_THEME.HEAD_IMG_URL is '头部图片'
/

comment on column TDUCK.FM_USER_FORM_THEME.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_USER_FORM_THEME.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_USER_FORM_THEME_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM_THEME
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_theme_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_USER_FORM_VIEW_COUNT
(
    ID          NUMBER(19)             not null
        primary key,
    FORM_KEY    VARCHAR2(50 char)      not null
        constraint FM_USER_FORM_VIEW_COUNT_KEY
        unique,
    COUNT       NUMBER(10)   default 0 not null,
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_USER_FORM_VIEW_COUNT is '用户表单查看次数'
/

comment on column TDUCK.FM_USER_FORM_VIEW_COUNT.FORM_KEY is '表单唯一标识'
/

comment on column TDUCK.FM_USER_FORM_VIEW_COUNT.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.FM_USER_FORM_VIEW_COUNT.CREATE_TIME is '创建时间'
/

create trigger TDUCK.FM_USER_FORM_VIEW_COUNT_SEQ_TR
    before insert
    on TDUCK.FM_USER_FORM_VIEW_COUNT
    for each row
    when (new.id is null)
begin
    select tduck.fm_user_form_view_count_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.SYS_ENV_CONFIG
(
    ID          NUMBER(19)                    not null
        primary key,
    ENV_KEY     VARCHAR2(100 char) default '' not null,
    ENV_VALUE   VARCHAR2(4000)                not null,
    UPDATE_TIME TIMESTAMP(0),
    CREATE_TIME TIMESTAMP(0)
)
    /

comment on table TDUCK.SYS_ENV_CONFIG is '系统环境配置表'
/

comment on column TDUCK.SYS_ENV_CONFIG.ID is '参数主键'
/

comment on column TDUCK.SYS_ENV_CONFIG.ENV_KEY is '配置key'
/

comment on column TDUCK.SYS_ENV_CONFIG.ENV_VALUE is '参数键值'
/

comment on column TDUCK.SYS_ENV_CONFIG.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.SYS_ENV_CONFIG.CREATE_TIME is '创建时间'
/

create trigger TDUCK.SYS_ENV_CONFIG_SEQ_TR
    before insert
    on TDUCK.SYS_ENV_CONFIG
    for each row
    when (new.id is null)
begin
    select tduck.sys_env_config_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.WX_MP_USER
(
    ID           NUMBER(10)         not null
        primary key,
    APPID        VARCHAR2(255 char) not null,
    NICKNAME     VARCHAR2(255 char),
    SEX          NUMBER(3),
    HEAD_IMG_URL VARCHAR2(255 char) not null,
    UNION_ID     VARCHAR2(150 char),
    OPEN_ID      VARCHAR2(150 char) not null,
    COUNTRY      VARCHAR2(255 char),
    PROVINCE     VARCHAR2(255 char),
    CITY         VARCHAR2(255 char),
    IS_SUBSCRIBE NUMBER(3)    default 1,
    USER_ID      NUMBER(19),
    UPDATE_TIME  TIMESTAMP(0) default SYSTIMESTAMP,
    CREATE_TIME  TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.WX_MP_USER is '微信公众号用户'
/

comment on column TDUCK.WX_MP_USER.ID is '主键'
/

comment on column TDUCK.WX_MP_USER.APPID is '公众号AppId'
/

comment on column TDUCK.WX_MP_USER.NICKNAME is '昵称'
/

comment on column TDUCK.WX_MP_USER.SEX is '性别'
/

comment on column TDUCK.WX_MP_USER.HEAD_IMG_URL is '头像'
/

comment on column TDUCK.WX_MP_USER.COUNTRY is '国家'
/

comment on column TDUCK.WX_MP_USER.PROVINCE is '省'
/

comment on column TDUCK.WX_MP_USER.CITY is '城市'
/

comment on column TDUCK.WX_MP_USER.IS_SUBSCRIBE is '是否关注'
/

comment on column TDUCK.WX_MP_USER.USER_ID is '用户Id'
/

comment on column TDUCK.WX_MP_USER.UPDATE_TIME is '更新时间'
/

comment on column TDUCK.WX_MP_USER.CREATE_TIME is '创建时间'
/

create trigger TDUCK.WX_MP_USER_SEQ_TR
    before insert
    on TDUCK.WX_MP_USER
    for each row
    when (new.id is null)
begin
    select tduck.wx_mp_user_seq.nextval into :new.id from dual;
end;
/

create table TDUCK.FM_FORM_THEME_CATEGORY
(
    ID          NUMBER(19)        not null
        primary key,
    NAME        VARCHAR2(50 char) not null,
    SORT        NUMBER(10)   default NULL,
    CREATE_TIME TIMESTAMP(0) default SYSTIMESTAMP,
    UPDATE_TIME TIMESTAMP(0) default SYSTIMESTAMP
)
    /

comment on table TDUCK.FM_FORM_THEME_CATEGORY is '表单主题分类'
/

comment on column TDUCK.FM_FORM_THEME_CATEGORY.NAME is '主题名称'
/

comment on column TDUCK.FM_FORM_THEME_CATEGORY.SORT is '排序'
/

comment on column TDUCK.FM_FORM_THEME_CATEGORY.CREATE_TIME is '创建时间'
/

comment on column TDUCK.FM_FORM_THEME_CATEGORY.UPDATE_TIME is '更新时间'
/

create trigger TDUCK.FM_FORM_THEME_CATEGORY_SEQ_TR
    before insert
    on TDUCK.FM_FORM_THEME_CATEGORY
    for each row
    when (NEW.id IS NULL)
BEGIN
    SELECT fm_form_theme_category_seq.NEXTVAL INTO :NEW.id FROM DUAL;
END;
/

create table TDUCK.AC_USER_LOGIN_FAIL
(
    ID          NUMBER,
    LOGIN_TIME  TIMESTAMP(6),
    DELETED     NUMBER,
    LOCKED      NUMBER,
    UNLOCK_TIME TIMESTAMP(6),
    UPDATE_TIME TIMESTAMP(6)
)
    /

comment on table TDUCK.AC_USER_LOGIN_FAIL is '用户登录信息表'
/

comment on column TDUCK.AC_USER_LOGIN_FAIL.LOGIN_TIME is '登录时间'
/

comment on column TDUCK.AC_USER_LOGIN_FAIL.DELETED is '是否删除'
/

comment on column TDUCK.AC_USER_LOGIN_FAIL.LOCKED is '是否锁定'
/

comment on column TDUCK.AC_USER_LOGIN_FAIL.UNLOCK_TIME is '解锁时间'
/

comment on column TDUCK.AC_USER_LOGIN_FAIL.UPDATE_TIME is '删除时间'
/

create table TDUCK.FM_FORM_CONIG
(
    FORM_KEY     VARCHAR2(50 char),
    PROCESS_NAME VARCHAR2(500 char),
    CREATE_TIME  TIMESTAMP(6) default SYSTIMESTAMP not null
)
    /

comment on table TDUCK.FM_FORM_CONIG is '问卷配置表'
/

comment on column TDUCK.FM_FORM_CONIG.FORM_KEY is '问卷KEY'
/

comment on column TDUCK.FM_FORM_CONIG.PROCESS_NAME is '存储过程名称'
/

comment on column TDUCK.FM_FORM_CONIG.CREATE_TIME is '创建时间'
/

INSERT INTO TDUCK.AC_USER (ID, NAME, AVATAR, GENDER, EMAIL, PHONE_NUMBER, PASSWORD, REG_CHANNEL, LAST_LOGIN_CHANNEL, LAST_LOGIN_TIME, LAST_LOGIN_IP, PASSWORD_TYPE, DELETED, CREATE_TIME, UPDATE_TIME) VALUES (1, 'admin', '1', 1, 'admin@hospital.com', null, '$2a$10$FgOTdkh3qVLE9DNgD4XzDu2PCJB3QtnGbriBPaMhMKTVWM9XYsiIm', '1', 1, TIMESTAMP '2024-03-21 18:17:20', '192.168.31.92', 1, 0, TIMESTAMP '2024-03-16 17:19:39', TIMESTAMP '2024-03-21 18:17:20');
INSERT INTO TDUCK.SYS_ENV_CONFIG (ID, ENV_KEY, ENV_VALUE, UPDATE_TIME, CREATE_TIME) VALUES (9, 'systemInfoConfig', '"webBaseUrl": "", "openWxMpLogin": false', TIMESTAMP '2024-03-16 17:19:39', TIMESTAMP '2024-03-16 17:19:39');
INSERT INTO TDUCK.SYS_ENV_CONFIG (ID, ENV_KEY, ENV_VALUE, UPDATE_TIME, CREATE_TIME) VALUES (14, 'fileEnvConfig', '"ossType": "LOCAL"', TIMESTAMP '2024-03-16 17:19:40', TIMESTAMP '2024-03-16 17:19:40');
INSERT INTO TDUCK.SYS_ENV_CONFIG (ID, ENV_KEY, ENV_VALUE, UPDATE_TIME, CREATE_TIME) VALUES (1, 'HOSPITAL_NAME', '"临泽县人民医院"', null, TIMESTAMP '2024-03-22 10:21:26');

